﻿using DataMgr.File;
using DataMgr.msg.req;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace DataMgr.mode
{

    public enum DwonState
    {
        DWON_FINISH = 0,    //下载完成
        DOWN_DOING,     //下载中
        DOWN_WAIT,      //等待中
        DOWN_REQUEST,   //未开始
        DOWN_ERROR,     //无法下载,下载出错

    }
    class ChannelTestInfo
    {
        public ChannelDeviceInfo devChlInfo;
        public double StartTime { get; set; }
        
        public DwonState State { get; set; }
        //（0下载完成，1下载中，2等待中, 3未开始，4无法下载）

        public string DownKey { get; set; }
        //key=guid+chl

        public UInt32 LastSeq { get; set; }
        //最新记录序号

        public ReqDown Request { get; set; }
        //开始的请求信息

        public DateTime LastUpdateTime { get; set; }

        public static string GetState(DwonState s)
        {
            string name = "";
            switch (s)
            {
                case DwonState.DWON_FINISH:
                    name = "下载完成";
                    break;
                case DwonState.DOWN_DOING:
                    name = "下载中";
                    break;
                case DwonState.DOWN_WAIT:
                    name = "等待中";
                    break;
                case DwonState.DOWN_REQUEST:
                    name = "未开始";
                    break;
                case DwonState.DOWN_ERROR:
                    name = "无法下载";
                    break;
                default:
                    break;
            }

            return name;
        }

    }


}
